import java.util.ArrayList;


public class PieceMoves {
	private Piece piece;
	private ArrayList<BoardMove> moves;
	private ArrayList<BoardMove> attacks;
	
	public PieceMoves(Piece piece, Board board) {
		setPiece(piece);
		board.getPieceMoves().put(piece, this);
		setMoves(new ArrayList<BoardMove>());
		setAttacks(new ArrayList<BoardMove>());
	}
	
	public Piece getPiece() {
		return piece;
	}
	
	public void setPiece(Piece piece) {
		this.piece = piece;
	}
	
	public ArrayList<BoardMove> getMoves() {
		return moves;
	}
	
	public void setMoves(ArrayList<BoardMove> moves) {
		this.moves = moves;
	}
	
	public ArrayList<BoardMove> getAttacks() {
		return attacks;
	}
	
	public void setAttacks(ArrayList<BoardMove> attacks) {
		this.attacks = attacks;
	}
	
	public boolean remove(BoardMove move){
		return getMoves().remove(move) || getAttacks().remove(move);
	}
	
	public ArrayList<BoardMove> getAllMoves(){
		ArrayList<BoardMove> array = new ArrayList<BoardMove>();
		array.addAll(getMoves());
		array.addAll(getAttacks());
		return array;
	}
	
	@Override
	public String toString() {
		return getPiece().getKindString() + " Moves: " + getMoves() + ", Attacks: " + getAttacks();
	}
}
